#ifndef QTPROJECTGENERATORFACTORY_H
#define QTPROJECTGENERATORFACTORY_H

#include <QList>
#include <QString>

#include "generatoroutputview.h"
#include "iqtprojectgenerator.h"

#define DYN_BUILDTARGET "_DynBuild_"

/**
  * This POV can tell about a platform (its name) and whether
  * it is the default platform to generate projects for.
  */
struct PlatformInfo
{
    /**
      * Meant to be used as a short menu item name.
      */
    QString m_platformName;

    /**
      * Meant to be used as a slightly more descriptive text for
      * the item.
      */
    QString m_shortDescription;

    /**
      * Meant to be used to set the user data for a QAction,
      * identifying the platform. All IDs shall start with the
      * string defined by DYN_BUILDTARGET, therefore all dynamically
      * created QAction instances dealing with building can be
      * identified as such.
      */
    QString m_platformId;

    /**
      * Whether the platform denoted by this platform info is
      * the default build target.
      */
    bool    m_isDefault;

    // ignore this - for internal use only
    void  * m_opaque;
};


/**
  * Manages IQtProjectGenerator types (static "plugins").
  */
class QtProjectGeneratorFactory
{
private:
    //
    // private member variables
    //
    QList<PlatformInfo>      m_supportedPlatforms;

public:
    //
    // lifetime management
    //
    QtProjectGeneratorFactory();

    /**
      * @return the list of platforms (<platform-name, is-default> tuples) supported.
      */
    QList<PlatformInfo> supportedPlatforms() const;

    /**
      * @return a newly created instance of a project generator with
      *         given name, or NULL on failure.
      *
      * @platformName the name of the platform to create project generator for
      */
    IQtProjectGenerator * createProjectGenerator(const QString       & platformName,
                                                 GeneratorOutputView & outputView,
                                                 QObject             * parent = NULL) const;

};

#endif // QTPROJECTGENERATORFACTORY_H
